<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html><head>
        <link rel="stylesheet" type="text/css" href="apidocs.css"/>
        <title>API docs for &ldquo;sympy.functions.combinatorial.numbers.lucas&rdquo;</title>
        </head>
        <body><h1 class="class">Class s.f.c.n.lucas(<a href="sympy.core.function.Function.html">Function</a>):</h1><span id="part">Part of <a href="sympy.functions.combinatorial.numbers.html">sympy.functions.combinatorial.numbers</a></span><div class="toplevel"><div><p>Lucas numbers</p>
<h1 class="heading">Usage</h1>
  <p>lucas(n) gives the nth Lucas number</p>
<h1 class="heading">Examples</h1>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">from</span> sympy <span class="py-keyword">import</span> *</pre>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span>[lucas(x) <span class="py-keyword">for</span> x <span class="py-keyword">in</span> range(11)]
<span class="py-output">[2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123]</span></pre>
<h1 class="heading">Mathematical description</h1>
  <p>Lucas numbers satisfy a recurrence relation similar to that of the 
  Fibonacci sequence, in which each term is the sum of the preceding two. 
  They are generated by choosing the initial values L_0 = 2 and L_1 = 
  1.</p>
<h1 class="heading">References and further reading</h1>
  <p>* http://en.wikipedia.org/wiki/Lucas_number</p>
</div></div><table class="children"><tr class="function"><td>Function</td><td><a href="#sympy.functions.combinatorial.numbers.lucas.canonize">canonize</a></td><td><div><p>Returns a canonical form of cls applied to arguments args.</p>
</div></td></tr></table>
            <div class="function">
            <div class="functionHeader">def <a name="sympy.functions.combinatorial.numbers.lucas.canonize">canonize(cls, n):</a></div>
            <div class="functionBody"><pre>Returns a canonical form of cls applied to arguments args.

The canonize() method is called when the class cls is about to be
instantiated and it should return either some simplified instance
(possible of some other class), or if the class cls should be
unmodified, return None.

Example of canonize() for the function "sign"
---------------------------------------------

@classmethod
def canonize(cls, arg):
    if arg is S.NaN:
        return S.NaN
    if arg is S.Zero: return S.One
    if arg.is_positive: return S.One
    if arg.is_negative: return S.NegativeOne
    if isinstance(arg, C.Mul):
        coeff, terms = arg.as_coeff_terms()
        if coeff is not S.One:
            return cls(coeff) * cls(C.Mul(*terms))</pre></div>
            </div></body>
        